<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>{{ metadata.title }}</title>
  <subtitle>{{ metadata.feed.subtitle }}</subtitle>
  <link href="{{ metadata.feed.url }}" rel="self"/>
  <link href="{{ metadata.url }}"/>
  <updated>{{ site.buildDate | rssDate }}</updated>
  <id>{{ metadata.feed.id }}</id>
  <author>
    <name>{{ metadata.author.name }}</name>
  </author>
  <icon>{{ metadata.icon }}</icon>
  <logo>{{ metadata.logo }}</logo>
  {% for post in collections.blogPosts -%}
    {% if loop.index0 < site.paginationCount %}
    {#  absoluteUrl comes from 11ty RSS Plugin (@see https://www.11ty.dev/docs/plugins/rss/) #}
    {% set absolutePostUrl -%}{{ post.url | url | absoluteUrl(metadata.url) }}{%- endset %}
    <entry>
      <title>{{ post.data.title }}</title>
      <link href="{{ absolutePostUrl }}"/>
      <updated>{{ post.date | rssDate }}</updated>
      <id>{{ absolutePostUrl }}</id>
      <content type="html" mode="escaped">{{ post.templateContent | replace("web-copy-code", "div") | htmlToAbsoluteUrls(absolutePostUrl) }}</content>
      {% for entry in post.data.authors %}
        {%- set author = collections.authors[entry] -%}
        <author>
          <name>{{ author.title | i18n(locale) }}</name>
        </author>
      {%- endfor %}
    </entry>
    {% endif %}
  {%- endfor %}
</feed>
